package SarasGlass;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.swing.JOptionPane;
/**
 *
 * @author Yerong
 * This is the invoice class
 * @since 11/10/2016
 */
public class invoice {
        // constant type rate
        final double rate = .098;
        private double sub = 0.0;
        private double tax = 0.0;
        private double total = 0.0;
        
        /**
         * Calculation through class invoice
         * @param id the invoice number
         * @param item1 the first item
         * @param item2 the second item
         * @param item3 the third item
         */
        public void calculate(int id, item item1, item item2, item item3){
            sub = item1.get_sub()+item2.get_sub()+item3.get_sub();
            System.out.println(sub);
            tax = rate * sub;
            total = sub + tax;
        }
        
        /**
         * Get subtotal
         * @return double the subtotal
         * @author Yerong
         */
        public double get_sub(){
            return sub;
        }
        
        /**
         * Get tax
         * @return double the tax
         * @author Yerong
         */
        public double get_tax(){
            return tax;
        }
        
        /**
         * Get total
         * @return double the total amount
         * @author Yerong
         */
        public double get_total(){
            return total;
        }
    
}
